package com.itheima.aop;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

// 学习通知类型
@Component
// @Aspect
@Order(1) // 数字越小,优先级越高
public class MyAdviceC {
    // 抽取切入点表达式
    @Pointcut("execution(* com.itheima.service.impl.DeptServiceImpl.*(..))")
    public void pt() {}

    @Before("pt()")
    public void before() {
        System.out.println("MyAdviceC 前置通知");
    }

    @AfterReturning("pt()")
    public void afterReturning() {
        System.out.println("MyAdviceC 后置通知");
    }
}
